<template>
  <div class="add_user_form">
    <div class="data_title">
      <i class="iconfont icon-shujukanban"></i>
      <h2>固件添加</h2>
    </div>
    <el-form ref="formRef" :model="form" label-position="right" label-width="100px">
      <el-form-item label="版本号">
        <el-input v-model="form.name" placeholder="Please input"></el-input>
      </el-form-item>
      <el-form-item label="固件描述">
        <el-input v-model="form.name" placeholder="Please input"></el-input>
      </el-form-item>
      <el-form-item label="选择文件">
        <el-upload
          class="upload-demo"
          action="https://jsonplaceholder.typicode.com/posts/"
          :on-preview="handlePreview"
          :on-remove="handleRemove"
          :before-remove="beforeRemove"
          multiple
          :limit="3"
          :on-exceed="handleExceed"
          :file-list="fileList"
        >
          <el-button type="primary">Click to upload</el-button>
        </el-upload>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit" :icon="Select">添加</el-button>
        <el-button type="primary" @click="onSubmit" :icon="Close">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { reactive } from 'vue'
import { Select, Close } from '@element-plus/icons-vue'
// do not use same name with ref
const form = reactive({
  name: '',
  region: '',
  date1: '',
  date2: '',
  delivery: false,
  type: [],
  resource: '',
  desc: '',
})

const onSubmit = () => {
  console.log('submit!')
}
</script>

<style>
.add_user_form {
  width: 450px;
}

.data_title i {
  float: left;
  margin-right: 10px;
  font-size: 20px;
  line-height: 30px;
  color: #605144 !important;
}

.data_title {
  height: 35px;
  width: 100%;
  border-bottom: 2px solid #d0c1b1;
  margin-bottom: 50px;
}

.data_title h2 {
  color: #605144 !important;
  font-size: 18px;
  line-height: 30px;
  font-weight: 400;
}
</style>